module Piston
  class RelayCommand < System::Windows::Input::ICommand

    # Action<object> execute
    def initialize(execute, can_execute = nil)
      super(execute, can_execute)
      @execute, @can_execute = execute, can_execute
    end

    def CanExecute(parameter)
      return @can_execute == nil ? true : @can_execute.call(parameter)
    end

    def Execute(parameter)
      @execute.call(parameter)
    end

  end
end